home *** CD-ROM | disk | FTP | other *** search
/ Computer Arts Interactive 29 / CAi29.iso / pc / featsoft.dxr / 00014_OOP Script.ls < prev    next >
Encoding:
Text File  |  1999-02-04  |  7.1 KB  |  240 lines

  1. property x, Y, spriteNum, right, down, step
  2.  
  3. on birth me, birthSpriteNum, birthX, birthY
  4.   set x to birthX
  5.   set Y to birthY
  6.   set step to 1
  7.   set leftOrRight to random(2)
  8.   set upOrDown to random(2)
  9.   if leftOrRight = 1 then
  10.     set right to 0
  11.   else
  12.     if leftOrRight = 2 then
  13.       set right to 1
  14.     end if
  15.   end if
  16.   if upOrDown = 1 then
  17.     set down to 0
  18.   else
  19.     if upOrDown = 2 then
  20.       set down to 1
  21.     end if
  22.   end if
  23.   set spriteNum to birthSpriteNum
  24.   return me
  25. end
  26.  
  27. on nextStep me
  28.   global toggleDown
  29.   if x > the right of sprite 13 then
  30.     set right to 0
  31.     if not soundBusy(1) then
  32.       puppetSound(1, "Bump")
  33.     end if
  34.   end if
  35.   if x < the left of sprite 13 then
  36.     set right to 1
  37.     if not soundBusy(1) then
  38.       puppetSound(1, "Bump")
  39.     end if
  40.   end if
  41.   if Y > the bottom of sprite 13 then
  42.     set down to 0
  43.     if not soundBusy(1) then
  44.       puppetSound(1, "Bump")
  45.     end if
  46.   end if
  47.   if Y < the top of sprite 13 then
  48.     set down to 1
  49.     if not soundBusy(1) then
  50.       puppetSound(1, "Bump")
  51.     end if
  52.   end if
  53.   if right then
  54.     set x to x + step
  55.   else
  56.     set x to x - step
  57.   end if
  58.   if down then
  59.     set Y to Y + step
  60.   else
  61.     set Y to Y - step
  62.   end if
  63.   set the locH of sprite spriteNum to x
  64.   set the locV of sprite spriteNum to Y
  65.   if rollOver(18) then
  66.     if toggleDown = 0 then
  67.       set toggleDown to 1
  68.       set right to 0
  69.       set down to 0
  70.       set step to 2
  71.       if not soundBusy(1) then
  72.         puppetSound(1, "Top")
  73.       end if
  74.     end if
  75.   else
  76.     if rollOver(19) then
  77.       if toggleDown = 0 then
  78.         set toggleDown to 1
  79.         set right to 0
  80.         set down to 0
  81.         set step to 1
  82.         if not soundBusy(1) then
  83.           puppetSound(1, "Top")
  84.         end if
  85.       end if
  86.     else
  87.       if rollOver(20) then
  88.         if toggleDown = 0 then
  89.           set toggleDown to 1
  90.           set down to 0
  91.           set step to 1
  92.           if not soundBusy(1) then
  93.             puppetSound(1, "Top")
  94.           end if
  95.         end if
  96.       else
  97.         if rollOver(21) then
  98.           if toggleDown = 0 then
  99.             set toggleDown to 1
  100.             set right to 1
  101.             set down to 0
  102.             set step to 1
  103.             if not soundBusy(1) then
  104.               puppetSound(1, "Top")
  105.             end if
  106.           end if
  107.         else
  108.           if rollOver(22) then
  109.             if toggleDown = 0 then
  110.               set toggleDown to 1
  111.               set right to 1
  112.               set down to 0
  113.               set step to 2
  114.               if not soundBusy(1) then
  115.                 puppetSound(1, "Top")
  116.               end if
  117.             end if
  118.           else
  119.             if rollOver(23) then
  120.               if toggleDown = 0 then
  121.                 set toggleDown to 1
  122.                 set right to 0
  123.                 set step to 1
  124.                 if not soundBusy(1) then
  125.                   puppetSound(1, "Middle")
  126.                 end if
  127.               end if
  128.             else
  129.               if rollOver(24) then
  130.                 if toggleDown = 0 then
  131.                   set toggleDown to 1
  132.                   set right to 0
  133.                   set step to 1
  134.                   if not soundBusy(1) then
  135.                     puppetSound(1, "Middle")
  136.                   end if
  137.                 end if
  138.               else
  139.                 if rollOver(25) then
  140.                   if toggleDown = 0 then
  141.                     set toggleDown to 1
  142.                     set step to 1
  143.                     if not soundBusy(1) then
  144.                       puppetSound(1, "Middle")
  145.                     end if
  146.                   end if
  147.                 else
  148.                   if rollOver(26) then
  149.                     if toggleDown = 0 then
  150.                       set toggleDown to 1
  151.                       set right to 1
  152.                       set step to 1
  153.                       if not soundBusy(1) then
  154.                         puppetSound(1, "Middle")
  155.                       end if
  156.                     end if
  157.                   else
  158.                     if rollOver(27) then
  159.                       if toggleDown = 0 then
  160.                         set toggleDown to 1
  161.                         set right to 1
  162.                         set step to 1
  163.                         if not soundBusy(1) then
  164.                           puppetSound(1, "Middle")
  165.                         end if
  166.                       end if
  167.                     else
  168.                       if rollOver(28) then
  169.                         if toggleDown = 0 then
  170.                           set toggleDown to 1
  171.                           set right to 0
  172.                           set down to 1
  173.                           set step to 2
  174.                           if not soundBusy(1) then
  175.                             puppetSound(1, "Bottom")
  176.                           end if
  177.                         end if
  178.                       else
  179.                         if rollOver(29) then
  180.                           if toggleDown = 0 then
  181.                             set toggleDown to 1
  182.                             set right to 0
  183.                             set down to 1
  184.                             set step to 1
  185.                             if not soundBusy(1) then
  186.                               puppetSound(1, "Bottom")
  187.                             end if
  188.                           end if
  189.                         else
  190.                           if rollOver(30) then
  191.                             if toggleDown = 0 then
  192.                               set toggleDown to 1
  193.                               set down to 1
  194.                               set step to 1
  195.                               if not soundBusy(1) then
  196.                                 puppetSound(1, "Bottom")
  197.                               end if
  198.                             end if
  199.                           else
  200.                             if rollOver(31) then
  201.                               if toggleDown = 0 then
  202.                                 set toggleDown to 1
  203.                                 set right to 1
  204.                                 set down to 1
  205.                                 set step to 1
  206.                                 if not soundBusy(1) then
  207.                                   puppetSound(1, "Bottom")
  208.                                 end if
  209.                               end if
  210.                             else
  211.                               if rollOver(32) then
  212.                                 if toggleDown = 0 then
  213.                                   set toggleDown to 1
  214.                                   set right to 1
  215.                                   set down to 1
  216.                                   set step to 2
  217.                                   if not soundBusy(1) then
  218.                                     puppetSound(1, "Bottom")
  219.                                   end if
  220.                                 end if
  221.                               else
  222.                                 set toggleDown to 0
  223.                                 set step to 1
  224.                               end if
  225.                             end if
  226.                           end if
  227.                         end if
  228.                       end if
  229.                     end if
  230.                   end if
  231.                 end if
  232.               end if
  233.             end if
  234.           end if
  235.         end if
  236.       end if
  237.     end if
  238.   end if
  239. end
  240.